package com.googlecode.tabletags.views.jsp.ui;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ui.AbstractUITag;

import com.googlecode.tabletags.components.Column;
import com.opensymphony.xwork2.util.ValueStack;

/**
 * @see Column
 */
public class ColumnTag extends AbstractUITag {
    // sort column attributes
    protected String sortKey;
    protected String sortable;
    protected String title;
    
    /**
     * @see org.apache.struts2.views.jsp.ComponentTagSupport#getBean(com.opensymphony.xwork2.util.ValueStack, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public Component getBean(ValueStack stack, HttpServletRequest req,
        HttpServletResponse res) {
        return new Column(stack, req, res);
    }

    /**
     * @see com.opensymphony.webwork.views.jsp.ui.AbstractUITag#populateParams()
     */
    protected void populateParams() {
        super.populateParams();

        Column column = ((Column) component);
        column.setSortKey(sortKey);
        column.setSortable(sortable);
    }

    public void setSortable(String sortable) {
        this.sortable = sortable;
    }

    public void setSortKey(String sortKey) {
        this.sortKey = sortKey;
    }
}
